Repository navigation
fix(web): hover styles work for mice reported as non-hovering - #40845
donpimponnousacondom-afk wants to merge 1 commit into
Conversation
Behind VNC/VDI, Chromium reports `hover: none` and `any-hover: none` while delivering real mouse events. Tailwind gates `hover:` on `(hover: hover)`, so every `hover:` and `group-hover:` utility is inert and controls revealed on hover, such as the assistant response toolbar (copy, fork, reply), stay invisible. When no hovering pointer is reported at boot, track the last pointer type: a mouse move sets `data-mouse-hover` on the root, touch and pen clear it. Presses can only clear it, because the app replays synthetic mouse presses. The `hover` and `any-hover` variants also match under that marker; `:where()` keeps the fallback at the specificity of the media-gated rule, so `active:` and state variants still win. Builds on pingdotgg#39090, which added the detection for the sidebar's `any-hover` actions. Co-authored-by: peter <p.e.smeets@gmail.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Problem
On Linux behind VNC, the buttons under each assistant response (copy, fork, reply) never appear on hover. Their tooltips still open, so the app shows "Fork from this response" over a button it keeps invisible. I did not know those buttons existed until I asked why a tooltip was floating over nothing.
The row is
opacity-0 … group-hover/assistant:opacity-100. Tailwind gateshover:on@media (hover: hover), and on this display Chromium reportshover: none,any-hover: noneandpointer: nonewhile still delivering normalpointerType: "mouse"events. So everyhover:andgroup-hover:utility in the web client is inert there, not only this row.To reproduce: run the desktop app, or
t3in Chromium, on an X11 session served over VNC. Open a thread with a completed assistant response and move the mouse over it.Change
main.tsx: when(any-hover: hover)is false at boot, track the last pointer type. A mousepointermovesetsdata-mouse-hoveron<html>; touch and pen clear it. Apointerdowncan only clear it, becauseHostedBrowserWebviewreplays a synthetic mousepointerdown.index.css: thehoverandany-hovervariants also match:hoverunder that marker.:where()gives the fallback the same specificity as the media-gated rule, and Tailwind keeps the variant's place in the cascade order.main.test.ts: the boot test covers mouse, touch, pen, presses, the replayed mouse press, and a machine that reports hover.Machines that report a hovering pointer never attach the listeners. Desktop wraps the same web bundle. Mobile is React Native and does not use this CSS.
Scope
A small fix for an obvious bug: hover-revealed buttons stay invisible while their own tooltips open. No new setting and no new UI text, so it has no linked issue.
Related: #21589 reported the same Chromium misreport on a Windows 2-in-1 and was closed as upstream. This case differs in three ways. On a VNC display the misreport is permanent: restarting the app or changing posture does not clear it. The app already receives the mouse events and acts on them for tooltips, so it contradicts itself. And the fix reads only those events: a machine that reports hover correctly never runs the new code.
This is intended to replace #39090 by @MyDigitalLife, which adds the same detection for the sidebar's
any-hoveractions and names plainhover:as a separate change. #39090 now conflicts withmainafter #26451. This PR carries its detection, rebased past #26451, with two changes: the marker follows the last pointer type instead of being set once, and theany-hoverfallback uses:where()instead of:is(). Its author is credited as co-author on the commit.Not covered: a tab whose hover capability changes after boot, pointer movement inside a guest webview, the preview annotation overlay (it compiles its own stylesheet), and
pointer: finegates such as the timeline minimap, which are a separate query.Verification
Found on Debian 13, X11 over VNC, T3 Code 0.1.11 desktop. On that display Chromium and Electron 44 both report
hover: none,any-hover: none,pointer: none.Electron, this commit. The desktop app run with
vp run dev:desktopon that display, against an isolated, seeded.t3, with the mouse over the assistant response of a Replay showcase thread:main'sindex.cssandmain.tsxswapped in): the row matches:hover, the marker is absent, and the toolbar's computed opacity is0.:hover,data-mouse-hoveris set, and the toolbar's computed opacity is1.Chromium, same listener code before the rebase. In the web client on that display: mouse move, touch tap, mouse move gave marker on, off, on. A touch tap followed by a synthetic mouse
pointerdownleft it off.Tests. The
main.test.tsrows that expect the marker fail onmainand pass with the fix.vp run check:changedpasses: format, lint, knip, typecheck, tests and the React compiler.Cost. Each hover rule is emitted twice, so the main stylesheet grows from 73.6 KB to 75.7 KB gzipped.
Not checked. A rebuilt AppImage. A physical pointer on the patched build: input in the runs above was dispatched through the DevTools protocol. I did not write a scenario for
vp run scenarios:prove, because the bug needs a browser that reports no hovering pointer, which depends on the display.Made with Claude Fable 5.2 in Claude Code, inside T3 Code. The detection carried from #39090 was made with Claude Opus 5.5 in Claude Code.
🤖 Generated with Claude Code
May the Code Be with You